//
//  HSYBaseVideoPlayerView.h
//  高仿暴走斗图
//
//  Created by key on 16/8/8.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import "HSYPlayerVolumeView.h"
#import "HSYPlayerBrightnessView.h"
#import "HSYPlayerTimeIndicatorView.h"

#define HSY_CUSTOM_VIDEO_PLAYER_OFFSET              15.0f
#define HSY_CUSTOM_VIDEO_PLAYER_WIDTH               IPHONE_WIDTH
#define HSY_CUSTOM_VIDEO_PLAYER_HEIGHT              HSY_CUSTOM_VIDEO_PLAYER_WIDTH *(9.0/16.0)

typedef NS_ENUM(NSUInteger, kVideoPlayerProgressPropertyType) {
    
    kVideoPlayerProgressPropertyTypeMinValue,                       //进度条最小值
    kVideoPlayerProgressPropertyTypeMaxValue,                       //进度条最大值
    kVideoPlayerProgressPropertyTypeProgessValue,                   //进度条当前值
    kVideoPlayerProgressPropertyTypeMinTintColor,                   //进度条完成进度的颜色
    kVideoPlayerProgressPropertyTypeMaxTintColor,                   //进度条未完成的进度颜色
    kVideoPlayerProgressPropertyTypeThumbImage,                     //进度条上拖动的按钮图片
    
};

typedef NS_ENUM(NSInteger, kPanGestureDirectionType) {
    
    kPanGestureDirectionTypeHorizontalMoved,                        //横向移动
    kPanGestureDirectionTypeVerticalMoved                           //纵向移动
};

@protocol HSYBaseVideoPlayerViewDelegate <NSObject>

@optional

- (void)progessControlEventTouchEndedForValue:(NSNumber *)value;
- (void)progessControlEventTouchBeganForSlider:(UISlider *)slider;

@end

@interface HSYBaseVideoPlayerView : UIView

@property (nonatomic, assign, readonly) CGFloat value;                                                      //当前播放的进度
@property (nonatomic, assign) CGFloat cacheProgess;
@property (nonatomic, assign) CGFloat maxValue;                                                             //最大播放进度
@property (nonatomic, strong, readonly) UIView *clearMask;                                                  //最底层的透明罩
@property (nonatomic, copy) void(^didPanGestrueChangeValueBlock)(NSNumber *value);                          //响应手势的滚动
@property (nonatomic, assign) CGFloat sumTime;                                                              //用于缓存转换的手指位移换算后的结果
@property (nonatomic, assign) kPanGestureDirectionType panDirection;                                        //区分手指的横竖滑动
@property (nonatomic, assign) BOOL isVolume;                                                                //判断区分是设置音量还是设置屏幕亮度
@property (nonatomic, weak) id<HSYBaseVideoPlayerViewDelegate>delegate;                                     //委托，实现某些情况
@property (nonatomic, strong, readwrite) HSYPlayerTimeIndicatorView *timeIndicatorView;                     //快进、快退指示器
@property (nonatomic, strong, readwrite) HSYPlayerBrightnessView *brightnessIndicatorView;                  //亮度指示器
@property (nonatomic, strong, readwrite) HSYPlayerVolumeView *volumeIndicatorView;                          //音量指示器

+ (HSYBaseVideoPlayerView *)showVideoPlayerViewForProgressProperty:(NSDictionary *)progressProperty
                                                             frame:(CGRect)frame
                                              didChangedValueBlock:(void(^)(NSNumber *value))valueblock
                                                    playVideoBlock:(void(^)(UIButton *button, CGFloat value))playBlock
                                                 scalingVideoBlock:(void(^)(UIButton *button))scalingBlock
                                     didPanGestrueChangeValueBlock:(void(^)(NSNumber *value))panChangeValueBlock;
- (void)updateVideoPlayState;
- (void)updateVideoStopState;
- (void)updateConstraint;
- (NSString *)setTimeLabelValues:(double)currentTime totalTime:(double)totalTime;
- (void)showAnimation;
- (void)hideAnimation;
- (void)activityAnimationByIsStartAnimation:(BOOL)startAnimating;
- (void)dispath_afterHideAnimation;

@end
